package org.qloudgen.borg.messaging;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.qloudgen.borg.CommonValues;
import org.qloudgen.borg.thread.Controller;

public final class MessagingBuilder {

	static Log log = LogFactory.getLog(MessagingBuilder.class);
	
	public static void buildMessaging(){
		
		CommonValues.getInstance().init();
		
		/*
		 * start internel message queue for receiving message
		 */
		new HornetqJmsServer(CommonValues.props.getProperty("queue")).start();
		
		/*
		 * start listener thread
		 */
		new Controller(CommonValues.props.getProperty("queue")).start();
		
		/*
		 * create sender handler
		 */
		HornetqJmsClient sender = new HornetqJmsClient(CommonValues.props.getProperty("queue"));
		sender.generateProducer();
		CommonValues.sender = sender;
		
	}
}
